Posts

Showing posts from August, 2018

pointer in c

Pointer in C Practice Questions: 1.What will be the output of the C program? #include<stdio.h> int main(){ int i = 3; int *j; j = &i; j++; printf("%d ",*j); return 0; } 2.What is the output of following program? # include <stdio.h> void fun(int x) {     x = 30; } int main() {   int y = 20;   fun(y);   printf("%d", y);   return 0; } 3. What will be the output of the C program? #include<stdio.h> int main() { char *ptr = "Pointer-to-String", i; printf("%s", ++ptr); return 0; } 4.Output of following program? # include <stdio.h> void fun(int *ptr) {     *ptr = 30; } int main() {   int y = 20;   fun(&y);   printf("%d", y);   return 0; } 5.What will be the output of the C program? #include<stdio.h> int main() { char *str = "His"; int i; for(i = 0; i < strlen(str); i++) printf("%s", str++); return 0; }...

Interview Question

Image
Loop programming exercises and solutions in C 1.      C program to print ODD numbers from 1 to N using while loop. 2.      C program to print all natural number in reverse (from n to 1) using loop. 3.      C program to print all uppercase alphabets using while loop. 4.      C program to print all lowercase alphabets using while loop. 5.      C program to count the no of digit in a number. 6.      C program to print numbers from 1 to 10 using while loop. 7.      C program to find first and last digit of a number. 8.      C Program to print tables from numbers 1 to 20. 9.      C program to find sum of first and last digit of a number. 10.   C Program to check entered number is ZERO, POSITIVE or NEGATIVE until user does not want to quit. 11.   C Program to find factorial ...

Python Interview Questions and Answers for Fresher

Image
Some  Basic Interview Question in Python: 1. Basic Python Interview Questions 2. What is the difference between list and tuples? 3. What is PEP 8? 4. What are the key features of Python? 5. How Python is interpreted? 6. What are Python decorators? 7. What is the difference between deep and shallow copy? 8. What is Dict and List comprehensions are? 9. How can the ternary operators be used in python? 10. What is lambda in Python? 11. What are generators in Python? 12. How is memory managed in Python? 13. What is pass in Python? 14. What is pickling and unpickling? 15. What is module and package in Python? 16. What is dictionary in Python? 17. In Python what are iterators? 18. Explain how to delete a file in Python? 19. What is monkey patching in Python? 20.What does this mean: *args, **kwargs? And why would we use it? 21.What are negative indexes and why are they used? 22.How can you randomize the items of a list in place in Python? ...

c programming

Image
1.Program to print "Hello C" using if and else statement both 2. Program to print source code as program output 3. C program to design Login Screen by validation username and password 4. Program to print weekday of given date       Solution: 1. #include <stdio.h> int main() {     if(!printf("Hello "))         ;     else         printf("C\n");     return 0; } 2#include <stdio.h> int main() {     FILE *fp;     char c;     fp = fopen(__FILE__, "r");     do     {         c=fgetc(fp);         putchar(c);     }     while(c!=EOF);     fclose(fp);     return 0; } ...

tricky c programs with solutions

Image
1.C program to print square and cube of all numbers from 1 to N using a goto statement 2. C program to check whether the number is EVEN or ODD using switch 3. C program to find a number of days in a month using switch case Solution: 1.#include<stdio.h> int main() {             int count,n;             printf("Enter the value of N: ");             scanf("%d",&n);                         count=1;                         start:             printf("num: %4d, Square: %4d, Cube: %4d\n",count,(count*count),(c...

C&C++ programming tricky questions

Image
        1 .   C++ program to calculate the sum of the digits of a number until the number is             a single digit             Example: Input: Enter a number: 147 Output: 3 Explanation: 147 → 1+4+7 = 12 → 1+2 = 3 2. C program to print message (Hello World/Hello C) without using any semicolon in program    3. C program to print your name 10 times without using any loop or goto statement Solutions: 1.#include <iostream.h> Void main() {             int number = 147;             int result; if(number)                         result = number % 9 == 0 ? 9 : number % 9 ; ...