Important Questions in C-Language

v  Difference between arrays and pointers?
v  What is the purpose of realloc( )?
v  What is static memory allocation and dynamic memory allocation?
v  How are pointer variables initialized?
v  Are pointers integers?
v  What is a pointer variable?
v  What is a pointer value and address?`
v  What is a method?
v  What are the advantages of the functions?
v  What is the purpose of main( ) function?
v  What is an argument ? differentiate between formal arguments and actual arguments?
v  What is a function and built-in function?
v  What is modular programming?
v  When does the compiler not implicitly generate the address of the first element of an array?
v  What are the characteristics of arrays in C?
v  Differentiate between a linker and linkage?
v  What are advantages and disadvantages of external storage class?
v  Diffenentiate between an internal static and external static variable?
v  What are the advantages of auto variables?
v  What is storage class and what are storage variable ?
v  Which expression always return true? Which always return false?
v  Write the equivalent expression for x%8?
v  why n++ executes faster than n+1?
v  what is a modulus operator? What are the restrictions of a modulus operator?
v  What is the difference between a string and an array?
v  Is it better to use a pointer to navigate an array of values,or is it better to use a subscripted array name?
v  Can the sizeof operator be used to tell the size of an array passed to a function?
v  Is using exit() the same as using return?
v  Is it possible to execute code even after the program exits the main() function?
v  What is a static function?
v  Why should I prototype a function?
v  How do you print an address?
v  Can math operations be performed on a void pointer?
v  How can you determine the size of an allocated portion of memory?
v  What is a “null pointer assignment” error? What are bus errors, memory faults, and core dumps?
v  What is the difference between NULL and NUL?
v  What is the heap?
v  Can the size of an array be declared at runtime?
v  What is the stack?
v  When should a far pointer be used?
v  What is the difference between far and near?
v  Is it better to use malloc() or calloc()?
v  Why should we assign NULL to the elements (pointer) after freeing them?
v  When would you use a pointer to a function?
v  How do you use a pointer to a function?
v  Can you add pointers together? Why would you?
v  What does it mean when a pointer is used in an if statement?
v  Is NULL always defined as 0?
v  What is a void pointer?
v  What is a null pointer?
v  How many levels of pointers can you have?
v  What is indirection?
v  How do you print only part of a string?
v  How can I convert a string to a number?
v  How can I convert a number to a string?
v  What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
v  How can you check to see whether a symbol is defined?
v  How do you override a defined macro?
v  What is #line used for?
v  What is a pragma?
v  What are the standard predefined macros?
v  How can type-insensitive macros be created?
v  How many levels deep can include files be nested?
v  Can include files be nested?
v  Can you define which header file to include at compile time?
v  What is the difference between #include and #include “file”?
v  Is it better to use a macro or a function?
v  How are portions of a program disabled in demo versions?
v  What is the benefit of using an enum rather than a #define constant?
v  What is the benefit of using #define to declare a constant?
v  Can a file other than a .h file be included with #include?
v  How can you avoid including a header more than once?
v  What will the preprocessor do for a program?
v  What is a macro, and how do you use it?
v  What is Preprocessor?
v  How can I make sure that my program is the only one accessing a file?
v  How can I open a file so that other programs can update it at the same time?
v  How do you determine whether to use a stream function or a low-level function?
v  What is the difference between text and binary modes?
v  How can you restore a redirected standard stream?
v  How do you redirect a standard stream?
v  How can I search for data in a linked list?
v  How can I sort a linked list?
v  What is hashing?
v  What is the quickest searching method to use?
v  What is the easiest searching method to use?
v  How can I sort things that are too large to bring into memory?
v  What is the quickest sorting method to use?
v  What is the easiest sorting method to use?
v  What is the benefit of using const for declaring constants?
v  Can static variables be declared in a header file?
v  What is the difference between declaring a variable and defining a variable?
v  Is it acceptable to declare/define a variable in a C header?
v  When should a type cast not be used?
v  When should a type cast be used?
v  How can you determine the maximum value that a numeric variable can hold?
v  How reliable are floating-point comparisons?
v  Can a variable be both const and volatile?
v  When should the volatile modifier be used?
v  100.When should the register modifier be used? Does it really help?
v Unix shell scripting questions……….
v  How do you find out what’s your shell? - echo $SHELL
v  What’s the command to find out today’s date? - date
v  What’s the command to find out users on the system? - who
v  How do you find out the current directory you’re in? - pwd
v  How do you remove a file? - rm
v  How do you remove a < in files the all with>- rm -rf
v  How do you find out your own username? - whoami
v  How do you send a mail message to somebody? - mail somebody@techinterviews.com-s ‘Your subject’ -c ‘cc@techinterviews.com
v  How do you count words, lines and characters in a file? - wc
v  How do you search for a string inside a given file? - grep string filename
v  How do you search for a string inside a directory? - grep string *
v  How do you search for a string in a directory with the subdirectories recursed? - grep -r string *
v  What are PIDs? - They are process IDs given to processes. A PID can vary from 0 to 65535.
v  How do you list currently running process? - ps
v  How do you stop a process? - kill pid
v  How do you find out about all running processes? - ps -ag
v  How do you stop all the processes, except the shell window? - kill 0
v  How do you fire a process in the background? - ./process-name &
v  How do you refer to the arguments passed to a shell script? - $1, $2 and so on. $0 is your script name.
v  What’s the conditional statement in shell scripting? - if {condition} then … fi
v  How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge
v  How do you test for file properties in shell scripts? - -s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, -d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability
v  How do you do Boolean logic operators in shell scripting? - ! tests for logical not, -a tests for logical and, and -o tests for logical or.
v  How do you find out the number of arguments passed to the shell script? - $#
v  What’s a way to do multilevel if-else’s in shell scripting? - if {condition} then {statement} elif {condition} {statement} fi
v  How do you write a for loop in shell? - for {variable name} in {list} do {statement} done
v  How do you write a while loop in shell? - while {condition} do {statement} done
v  How does a case statement look in shell scripts? - case {variable} in {possible-value-1}) {statement};; {possible-value-2}) {statement};; esac
v  How do you read keyboard input in shell scripts? - read {variable-name}
v  How do you define a function in a shell script? - function-name() { #some code here return }

v  How does get opts command work? - The parameters to your script can be passed as -n 15 -x 20. Inside the script, you can iterate through the getopts array as while getopts n:x option, and the variable $option contains the value of the entered option. 
Important Questions in C-Language Important Questions in C-Language Reviewed by Suresh Bojja on 7/01/2016 06:30:00 AM Rating: 5

Subjects & Labs

Theme images by sebastian-julian. Powered by Blogger.